<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    function fn(){
      console.log(this);
    }

    //声明两个对象  obj1.fn();
    var obj1 = {name: '张三'};
    var obj2 = {name: '李四'};

    //调用bind.   多次 bind, 只有第一次会生效, 后续无法再次修改返回函数的 this 值
    // var res = fn.bind(obj1);
    // var res2 = res.bind(obj2);

    var res2 = fn.bind(obj1).bind(obj2);

    res2();

  </script>
</body>
</html>